package com.mycompany.j2eem.Mapper.wrjmapper;

import com.mycompany.j2eem.Entity.bean.PictureInDBBean;
import com.mycompany.j2eem.Entity.bean.TagMapperBean;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author wurj
 * @time 2019/5/14 15:00
 * @description
 */
public interface SearchMapper {

    //搜索全部标签
    @Select("SELECT id,tagname,count from TagName")
    List<TagMapperBean> getTags();

    @Select("SELECT tagname from TagName")
    List<String> gett();

    //获取指定tag的图片
    //wucy改
    @Select("select Picture.id,picturepath from Picture,Picture_Attritube where Picture_Attritube.TagName_id=#{TagName_id} and Picture_id = Picture.id")
    List<PictureInDBBean> getPictures(@Param("TagName_id")String id);

    //获取指定tag的图片
    @Select("select id,picturepath from Picture where id=#{id}")
    PictureInDBBean getPicture(@Param("id")String id);

    //查询父亲
    @Select("select TagName_parent_id  from TagParentRelationship where TagName_id=#{TagName_id}")
    List<String> getTagNameIdFromParent(@Param("TagName_id") String id);


    //查询孩子
    @Select("select TagName_Child_id  from TagChildRelationship where TagName_id=#{TagName_id}")
    String getTagNameIdFromChild(@Param("TagName_id") String id);

    //查询标签名
    @Select("select tagname from TagName where id=#{TagName_Child_id}")
    String getChildName(@Param("TagName_Child_id")String id);

    //查询权限
    @Select("select private from Picture where id=#{id}")
    String getAuthorize(@Param("id")String id);

    //查询tag的id
    @Select("select id from TagName where tagname=#{tagname}")
    String getTagId(@Param("tagname")String name);

    //查询子标签的id
    @Select("select TagName_Childt_id from TagChildRelationship where TagName_id=#{parentId}")
    List<String> getChildren(@Param("parentId")String id);

    //获取标签名
    @Select("select tagName from TagName where id=#{tagID}")
    String getTagName(@Param("tagID")String id);

    //获取用户id
    @Select("select id from Account where username=#{username}")
    String getAccountID(@Param("username")String name);

    //获取喜欢的图片
    @Select("select Picture_id from Like_picture where Account_id=#{id}")
    List<String> getAccountLikePics(@Param("id") String accountID);


    @Select("select nickname from User where id=#{id}")
    String getUserName(@Param("id") String userID);

    @Select("select picture from User where id=#{id}")
    String getUserHeadPath(@Param("id")String userID);

    @Select("select Account_id from User where Account_id=#{id}")
    String getUserIDByAccountId(@Param("id") String s);

    @Select("select * from Account")
    List<String> getAllAccountId();



}
